import React, { Component } from 'react';
import { ScrollView, Image, View } from 'react-native';
import {CellImages} from '../../views/cellImages'
import { connect } from 'react-redux';

class NoCodeDetail extends Component() {
    constructor(props) {
        super(props);
        this.data = {
            count: null,
            gooodsItem: null,
        }
    }
    componentDidMount() {
        const { navigation } = this.props;
        const item = JSON.parse(navigation.getParam("item"));
        const count = navigation.getParam("count");
        this.setState({
            gooodsItem: item,
            count: count,
        })
    }

    render() {
        const { count,gooodsItem } = this.state
        return (
            <ScrollView style={styles.container}>
                <View style={Style.aic}>
                    <CellTitleItem title="入库商品" />
                    {
                        this.state.gooodsItem ?
                            <GoodItem
                                source={gooodsItem.images[0]}
                                name={gooodsItem.Name}
                                key={gooodsItem.name}
                                showAngle={false}
                                detailList={gooodsItem.detailList}
                                pressItem={() => { return }}
                                noBorder={true}
                            /> : null
                    }
                    <View style={[Style.gap, Style.gapTop]} />
                    <CellTitleItem title="手动确认的入库数量与照片" />
                    <CellItem title="入库数量" content={count} />
                    {
                        gooodsItem.intoImages && gooodsItem.intoImages.length > 0 ? <CellImages images={gooodsItem.images} /> : null
                    }
                    <View style={Style.bottom}></View>
                </View>
            </ScrollView>
        )
    }
}

export default connect()(NoCodeDetail)
